/*
 *  game.h
 *  Angel&Demon
 *
 *  Created by Si-Mohamed Lamraoui on 29/10/10.
 *  Copyright 2010 UJF. All rights reserved.
 *
 */

#ifndef __GAME_H__
#define __GAME_H__


//#define PSP 1

#include <stdio.h>
#include <stdlib.h>


#ifdef PSP
	#include <SDL/SDL.h>
	#include <SDL/SDL_ttf.h>
	#include "pspfunc.h"
#else
	#include "SDL.h"
	#include <SDL_ttf/SDL_ttf.h>
#endif

#include "utils.h"
#include "anim.h"


#define SCREEN_H 272 //PSP screen size :
#define SCREEN_W 480

#define ACTIVE 2
#define TRUE 1
#define FALSE 0

#define CASE_SIZE 20
#define NB_CASE_H 12
#define NB_CASE_W 12

#define LEFT_ANGLE_X 3
#define LEFT_ANGLE_Y 125
#define UP_ANGLE_X 223
#define UP_ANGLE_Y -6
#define RIGHT_ANGLE_X 424

#define BASE_SCORE 100
#define BASE_MOB 10

#define MS 1000

typedef enum {
	UP,
	DOWN,
	LEFT,
	RIGHT
} orient_e;

typedef enum {
	NONE,
	DEMON,
	ANGEL,
} state_e;


void display_title(SDL_Surface *screen);
void display_gameover(SDL_Surface *screen);
void increase_score(state_e state);
void move_up(void);
void move_down(void);
void move_right(void);
void move_left(void);
void change_state_demon(void);
void change_state_angel(void);
void monster_touch(void);
#ifdef PSP
int psp_event_listener(void);
#else
int basic_event_listener(void);
#endif
int init(void);
int game(void);

SDL_Rect posAbs;
SDL_Rect posMonster;
SDL_Rect posMsg;
SDL_Rect anim_death_pos;

SDL_Surface *screen;
SDL_Surface *map;
SDL_Surface *monster_demon;
SDL_Surface *monster_angel;
SDL_Surface *player_up;
SDL_Surface *player_down;
SDL_Surface *player_left;
SDL_Surface *player_right;
SDL_Surface *demon_mini;
SDL_Surface *angel_mini;
SDL_Surface *msg_akuma;
SDL_Surface *msg_tenshi; 
SDL_Surface *hud; 
SDL_Surface *light1;
SDL_Surface *title;

TTF_Font *font_20;
TTF_Font *font_30;

orient_e orient;

state_e state;
state_e old_state;
state_e monster[NB_CASE_W][NB_CASE_H];

int pos_x;
int pos_y;
int draw_msg;
int animation;
int animation_light;

int anim_y;
int alpha_light;
int chrono;
int score;
int angel_bar;
int tmp_angel_bar;
int demon_bar;
int tmp_demon_bar;
int nb_demon;
int nb_angel;
int chaine;


int animation_death;
int anim_death_y;
int alpha_death;
state_e anim_death_state;

int anim_bar_z;

anim_t *anim_demon_hat;
anim_t *anim_angel_hat;

mytimer_t timer_anim_monster;
mytimer_t timer_anim_light;
mytimer_t timer_chrono;
mytimer_t timer_move;


#endif